import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'uno.css'
import '@unocss/reset/tailwind.css'


const app = createApp(App)
app.use(store)
app.use(router)
app.mount('#app')

const clearExpiredTempOrders = () => {
    const tempOrders = JSON.parse(localStorage.getItem('temp-orders') || '[]')
    // 保留30分钟内的未支付订单
    const validOrders = tempOrders.filter(
        o => Date.now() - o.timestamp < 30 * 60 * 1000
    )
    localStorage.setItem('temp-orders', JSON.stringify(validOrders))
}
clearExpiredTempOrders()